package a.codetop.笔试框架.其他;

import java.util.ArrayList;
import java.util.List;

public class 每组选一个 {

    //1、准备Map
    char[][] c = {
            {},
            {'a','b','c'},
            {'d','e','f'},
            {'g','h','i'},
            {'j','k','l'},
            {'m','n','o'},
            {'p','q','r','s'},
            {'t','u','v'},
            {'w','x','y','z'}
    };
    //2、step每层用step号使用同一组数据
    private void 每组选一个(String s,int step) {
        if(tmp.length() == s.length()) {
            res.add(new String(tmp.toString()));
            return;
        }
        //
        int row = Integer.parseInt(s.charAt(step)+"")-1;//map中取出这层对应的行号
        //
        for (int i = 0; i < c[row].length; i++) {
            tmp.append(c[row][i]);
            每组选一个(s,step+1);//每次必跳过一个
            tmp.deleteCharAt(tmp.length()-1);
        }
    }
    List<String> res = new ArrayList<>();
    StringBuilder tmp = new StringBuilder();

}
